In [ ]:
# Requires GLPlot
using ApproxFun
In [ ]:
# domain is a square
d=Interval()^2
# initial condition
u0 = Fun((x,y)->exp(-40(x-.1)^2-40(y+.2)^2)+.5exp(-30(x+.5).^2-40(y+.2).^2),d)
# dirichlet boundary conditions
B=dirichlet(d)
Δ=lap(d)
h=0.0001 # time step
timeevolution(B,Δ,u0,h);
In [ ]:
d=Interval()^2
u0 = Fun((x,y)->exp(-40(x-.1)^2-40(y+.2)^2),d)
B=dirichlet(d)
D=Derivative(Interval())
L=(0.01D^2-4D)⊗I + I⊗(0.01D^2-3D)
h=0.002
timeevolution(B,L,u0,h)
In [ ]:
# domain is a square
d=Interval()^2
# initial condition
u0 = Fun((x,y)->exp(-50x^2-40(y-.1)^2)+.5exp(-30(x+.5)^2-40(y+.2)^2),d)
# dirichlet boundary conditions, try neumann(d). mixed is also possible
B= dirichlet(d)
Δ=lap(d)
h = 0.005
# the 2 specifies that we are solving a second order equation
# the default is to take u_t(x,0)=0
timeevolution(2,B,Δ,u0,h)
In [ ]:
h = 0.005
# initial condition
d=Interval()^2
u0 = Fun((x,y)->exp(-50x.^2-40(y-.1).^2)+.5exp(-30(x+.5).^2-40(y+.2).^2),d)
dx=d[1];dy=d[2]
B= [[ldirichlet(dx),rneumann(dx)]⊗I,I⊗dirichlet(dy)]
Δ=lap(d)
timeevolution(2,B,Δ,u0,h)
In [ ]:
d=Interval()^2
# initial condition
u0 = Fun((x,y)->exp(-50x.^2-40(y-.1).^2)+.5exp(-30(x+.5).^2-40(y+.2).^2),d)
B= dirichlet(d)
L=lap(d)-100I
h = 0.003
timeevolution(2,B,L,u0,h)
In [ ]:
d=Interval()^2
# initial condition
u0 = Fun((x,y)->2.exp(-50x^2-50y^2),d)
B= dirichlet(d)
L=lap(d)-I
g(u)=u-sin(u)
h = 0.0024
timeevolution(2,B,L,g,u0,h)
In [ ]: